<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="sealte.hvpms.pojo.*,sealte.hvpms.dao.impl.*,java.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<base href="<%=basePath%>" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>OVMS</title>
		<link type="text/css" rel="stylesheet" href="css/vp_preview.jsp.css" />
		<script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
		<script src="js/vp.add.view.js" type="text/javascript"></script>
	</head>
	<body>
		<%
			UserCreate uc = (UserCreate) session.getAttribute("UserCreate");
			if (uc != null) {
		%>
		<div id="num2">
		<h2><img src="images/page.png">&nbsp;投票信息管理--预览</h2>
		</div>
		<span id="message_addSuccess">[生成投票--成功]</span>
		<div id="wrapper">
			<div id="left">
				<table>
					<%
						Poll poll = (Poll) session.getAttribute("vp_add1");
							PollDAOImpl pb = new PollDAOImpl();
							int poll_id = pb.getID(poll.getName(), uc.getId());
							if (poll_id != 0) {
								PollOptionDAOImpl pob = new PollOptionDAOImpl();
								List<PollOption> all = pob.getPOAll(poll_id);
								Iterator<PollOption> iter = all.iterator();
								while (iter.hasNext()) {
									PollOption po = iter.next();
					%>
					<tr>
						<td width="4%" valign="top">
							<input type="checkbox" value="<%=po.getId()%>" />
						</td>
						<td>
							<%=po.getId()%>.<%=po.getContent()%><br />
							<%
								if(!po.getImage().equals("")){
							%>
							<img src="<%=po.getImage()%>" onload="proDownImage(this);" />
							<%} %>
							<br />
							<%=(po.getLink().equals("")) ? ""
								: ("相关链接：" + po.getLink())%>
							<hr class="bottom_hr" />
						</td>
					</tr>
					<%
						}
							} else {
								out.println("系统出错，请联系开发者");
							}
					%>
				</table>
			</div>
			<div id="right">
				<%
					poll.setRule_str((new RulesDAOImpl()).getContentByID(poll
								.getRule_int()));
				%>
				<table>
					<tr>
						<td align="right">
							标题：
						</td>
						<td align="left"><%=poll.getName()%></td>
					</tr>
					<tr>
						<td align="right" valign="top">
							描述：
						</td>
						<td align="left">
							<%=poll.getDescriptions()%>
						</td>
					</tr>
					<tr>
						<td align="right">
							最大可选项数：</td><td align="left"><%=poll.getMaxanswers()%></td>
					</tr>
					<tr>
						<td align="right">
							到期日期：</td><td align="left"><%=poll.getEnddate()%></td>
					</tr>
					<tr>
						<td align="right">
							限制规则：
						</td>
						<td align="left"><%=poll.getRule_str()%></td>
					</tr>
				</table>
			</div>
		</div>
		<%
			} else {
				out.println("谢绝跨路径访问！");
			}
		%>
	</body>
</html>